home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com
- Newsgroups: comp.lang.c++
- Subject: Re: GCC and Default Constructors
- Date: 21 Jan 1996 18:04:17 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4dtv71$1eh@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe11.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 20, 1996 17:29:29 in article <GCC and Default Constructors>, 'Eric
- Richard <erichard@netgen.com>' wrote:
-
-
- >I just spent about 3 days intermittently trying to solve a problem that
- >I finally figured out and I was trying to see if there is something
- >I can do to avoid a similar situation.
- >
- >Basically my problem stemmed from a typo on my part and the fact
- >that C++ will automatically provide a default constructor for you if
- >you don't provide one. To make a long story short, I had a class
- >named 'QueryTable' and had defined a constructor 'queryTable::QueryTable'.
-
- >Now obviously this is wrong, but what was screwing me up was that no
- >error was being generated because G++ was happily providing me with
- >a default constructor for my class.
- >
- Are you saying that the compiler accepted a function definition
- for an undeclared class??? Any decent compiler -- and gcc/g++
- certainly is decent -- should not only warn you, but refuse to compile
- the file. Maybe you've left out something relevant. Or maybe you
- have another typo.
-
- >So, my question is this: Does anybody know if there is some way
- >of at least getting G++ to warn you if it is using a default constructor?
- >If I had that, I would've been able to figure this out much more quickly.
- >
- No, there isn't, and I'm not convinced that there ought to be one.
- Like the old saw: Too many warnings spoil the stew -- or maybe I
- now have a typo :-).
-
- Excessive warnings defeat their purpose. IMHO, warnings about
- default constructors borderlines on the excessive.
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-